package top.yuki.event;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import top.yuki.LevelWorld;
import top.yuki.board.PlayerBoard;
import top.yuki.data.DataManager;
import top.yuki.data.DayDataManager;
import top.yuki.data.TempDataManage;

public class onPlayerJoin implements Listener {


    public DataManager dataManage;
    public DayDataManager dayDataManager;
    public TempDataManage tempDataManage;

    public onPlayerJoin (LevelWorld lw){
        this.dataManage = lw.dataManage;
        this.dayDataManager = lw.dayDataManager;
        this.tempDataManage = lw.tempDataManage;
    }
    @EventHandler
    public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) {
        Player p = (Player) event.getPlayer();

        dataManage.initPlayer(p);
        dayDataManager.initPlayerData(String.valueOf(p.getUniqueId()));
        tempDataManage.initPlayerData(String.valueOf(p.getUniqueId()));


        PlayerBoard playerBoard = new PlayerBoard(p);
        playerBoard.show();


    }
}
